package com.example.library.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.library.common.Result;
import com.example.library.entity.Book;
import com.example.library.entity.Soldout;
import com.example.library.service.ISoldoutService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 胡绍杆
 * @since 2022-06-16
 */
@RestController
@RequestMapping("/soldout")
public class SoldoutController {

    @Resource
    private ISoldoutService soldoutService;

    //新增和修改
    @PostMapping
    private Result save(@RequestBody Soldout soldout) {
        return Result.success(soldoutService.saveOrUpdate(soldout));
    }

    //查询所有数据
    @GetMapping
    public Result index(){
        return Result.success(soldoutService.list());
    }

}
